<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
    // window.onload  等页面里面的所有内容(dom,图片,视频)加载完毕之后在执行此函数
    window.onload = function () {
        var box = document.getElementById("box");
        console.log(box);
    }
    </script>
</head>

<body>
    <div id="box"></div>
    <img src="./images/1.png" alt="">
</body>
<script>
    // 当浏览器大小改变时触发此函数
    window.onresize = function () {
        console.log("您改变了窗口大小");
    }


</script>


</html>